#ifndef VECTEST_H_
#define VECTEST_H_

#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>

#include "../../src/math/math.h"

using physicsworks::math::equal;
using physicsworks::math::Vec;
using physicsworks::operator*;

class VecTest : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE(VecTest);
	CPPUNIT_TEST(testEquality);
	CPPUNIT_TEST(testBasicOperations);
	CPPUNIT_TEST_SUITE_END();
	
private:
	Vec<float> *af3, *bf3;
	Vec<double> *ad3, *bd3;
	
public:

	void setUp() {
		af3 = new Vec<float>(3);
		bf3 = new Vec<float>(3);
		
		(*af3)(0) = 4.3;
		(*af3)(1) = 6;
		(*af3)(2) = 8.1;
		
		(*bf3)(0) = 4.3;
		(*bf3)(1) = 6;
		(*bf3)(2) = 8.1;
		
		ad3 = new Vec<double>(3);
		bd3 = new Vec<double>(3);
		
		(*ad3)(0) = 7.3;
		(*ad3)(1) = 6;
		(*ad3)(2) = 8.3;
		
		(*bd3)(0) = 7.3;
		(*bd3)(1) = 6;
		(*bd3)(2) = 8.3;
	}
	
	void testEquality() {
		CPPUNIT_ASSERT( *af3 == *bf3 );
	}
	
	void testBasicOperations() {
		Vec<float> vf0 = float(5.0) * (*af3) - (*bf3) * 4 - (*bf3);
		Vec<float> vf1(3);
		vf1(0) = 0; vf1(1) = 0; vf1(2) = 0;
		CPPUNIT_ASSERT( vf0 == vf1 );
		
		Vec<double> vd0 = double(5.0) * (*ad3) - (*bd3) * 4 - (*bd3);
		Vec<double> vd1(3);
		vd1(0) = 0; vd1(1) = 0; vd1(2) = 0;
		CPPUNIT_ASSERT( vd0 == vd1 );
	}
	
	void tearDown() {
		delete af3;
		delete bf3;
		
		delete ad3;
		delete bd3;
	}
	
};

#endif /*VECTEST_H_*/
